    importPackage(android.graphics)
    importPackage(org.opencv.core)
    importPackage(org.opencv.android)
    importPackage(org.opencv.imgproc)
    importPackage(org.opencv.imgcodecs)
    importPackage(java.io)

    //封装常量

    let IMREAD_ANYDEPTH=2 //读取任意深度的图片
    let IMREAD_COLOR=1 //加载图像为彩色图像
    let IMREAD_GRAYSCALE=0 //加载图像为灰度图像
    let IMREAD_IGNORE_ORIENTATION=128 //如果设置，请不要根据EXIF的方向标志旋转图像。
    let IMREAD_LOAD_GDAL=8 //如果设置，使用gdal驱动程序加载图像
    let IMREAD_REDUCED_COLOR_2=17 //如果设置，则始终将图像转换为3通道BGR彩色图像，图像尺寸减小1/2。
    let IMREAD_REDUCED_COLOR_4=33 //如果设置，则始终将图像转换为3通道BGR彩色图像，图像尺寸减小1/4。
    let IMREAD_REDUCED_COLOR_8=65   //如果设置，则始终将图像转换为3通道BGR彩色图像，图像尺寸减小1/8。
    let IMREAD_REDUCED_GRAYSCALE_2=16 //如果设置，则始终将图像转换为单通道灰度图像，图像尺寸减小1/2
    let IMREAD_REDUCED_GRAYSCALE_4=32 //如果设置，则始终将图像转换为单通道灰度图像，图像尺寸减小1/4
    let IMREAD_REDUCED_GRAYSCALE_8=64 //如果设置，则始终将图像转换为单通道灰度图像，图像尺寸减小1/8
    let IMREAD_UNCHANGED=-1 //如果设置，则按原样返回加载的图像（使用Alpha通道，否则会被裁剪）
    function Imread(FilePath,flag){//mat对象操作-读取图片并转换为mat对象
        let ret = new Mat()
        if (flag == null){ret = Imgcodecs.imread(FilePath,IMREAD_UNCHANGED)}
        else{ret = Imgcodecs.imread(FilePath,flag)}
    }
    //封装常量
    let CV_16F = CvType.CV_16F
    let CV_16S = CvType.CV_16S
    let CV_16U = CvType.CV_16U
    let CV_32F = CvType.CV_32F
    let CV_32S = CvType.CV_32S
    let CV_64F = CvType.CV_64F
    let CV_8S = CvType.CV_8S
    let CV_8U = CvType.CV_8U
    let CV_USRTYPE1 = CvType.CV_USRTYPE1
    function Create(size1,size2,cvtype){//mat对象操作-mat对象的创建,参数1,参数2必选,参数3可选,默认为CvType.CV_8U
        if (cvtype == null){cvtype=CvType.CV_8U}
        let ret = new Mat
        ret.create(size1,size2,cvtype)
        return ret
    }

    function CopyTo(m){//mat对象操作-mat对象的拷贝--参数1必选
        let ret = new Mat()
        m.copyTo(ret)
        return ret
    }

     function imwrite(FilePath,m){//mat对象操作-mat对象的保存--参数1,参数2必选
        Imgcodecs.imwrite(FilePath,m)
     }

//基础形状绘制与填充
    function SetScalar(B,G,R){//设置一个基础形状的颜色,参数1,参数2,参数3必选
        return new Scalar(B,G,R)
    }
    function SetPoint(x,y){//设置一个坐标--参数1,参数2必选
        return new Point(x,y)
    }
    function SetSize(Lx,Ly){//用于设置椭圆尺寸--参数1,参数2必选

    }
    let LINE_4 = 4
    let LINE_8 = 8
    let LINE_AA = 16
    function Line(img,pt1,pt2,color,thickness,lineType,shift){//mat图像,起始点,结束点,颜色,绘制宽度,绘制方法,位置偏移
    //参数1,参数2,参数3必选,参数4,参数5,参数6,参数7可选
        if (img == null || pt1 == null || pt2 == null){
        logd("可选参数未填写");
        toast("可选参数未填写");
        return null;
        }
        if(color == null){color = new Scalar(0,0,0)}
        if(thickness == null){thickness = 1}
        if(lineType == null){lineType = LINE_4}
        if(shift == null){shift = 0}
        Imgproc.line(img,pt1,pt2,color,thickness,lineType,shift);
    }

    function Rectangle(img,pt1,pt2,color,thickness,lineType,shift){//mat图像,起始点,结束点,颜色,绘制宽度,绘制方法,位置偏移
        //参数1,参数2,参数3必选,参数4,参数5,参数6,参数7可选
        if (img == null || pt1 == null || pt2 == null){
        logd("可选参数未填写");
        toast("可选参数未填写");
        return null;
        }
        if(color == null){color = new Scalar(0,0,0)}
        if(thickness == null){thickness = 1}
        if(lineType == null){lineType = LINE_4}
        if(shift == null){shift = 0}
        Imgproc.rectangle(img,pt1,pt2,color,thickness,lineType,shift);
    }

    function Circle(img,center,radius,color,thickness,lineType,shift){//mat图像,圆中心点,圆半径,颜色,绘制宽度,绘制方法,位置偏移
        if (img == null || center == null || radius == null){
        logd("可选参数未填写");
        toast("可选参数未填写");
        return null;
        }
        if(color == null){color = new Scalar(0,0,0)}
        if(thickness == null){thickness = 1}
        if(lineType == null){lineType = LINE_4}
        if(shift == null){shift = 0}
        Imgproc.circle(img,center,radius,color,thickness,lineType,shift)
    }

    function Ellipse(img,center,axes,angle,startAngle,endAngle,color,thickness,lineType,shift){
        //mat图像,point 椭圆中心点,Size 圆半径,旋转角度,开始角度大小,结束角度大小,颜色,绘制宽度,绘制方法,位置偏移
        //参数1,参数2,参数3,必选,参数4,参数5,参数6,参数7可选
        if (img == null || center == null || axes == null){
                logd("可选参数未填写");
                toast("可选参数未填写");
                return null;
        }
                if(startAngle == null){startAngle = 0}
                if(endAngle == null){endAngle = 360}
                if(angle == null){angle == endAngle - startAngle}
                if(color == null){color = new Scalar(0,0,0)}
                if(thickness == null){thickness = 1}
                if(lineType == null){lineType = LINE_4}
                if(shift == null){shift = 0}
                Imgproc.ellipse(img,center,axes,angle,startAngle,endAngle,color,thickness,lineType,shift)

    }

        let FONT_HERSHEY_COMPLEX=3
        let FONT_HERSHEY_COMPLEX_SMALL=5
        let FONT_HERSHEY_DUPLEX=2
        let FONT_HERSHEY_PLAIN=1
        let FONT_HERSHEY_SCRIPT_COMPLEX=7
        let FONT_HERSHEY_SCRIPT_SIMPLEX=6
        let FONT_HERSHEY_SIMPLEX=0
        let FONT_HERSHEY_TRIPLEX=4
        let FONT_ITALIC=16
   function PutText(img,text,org,fontFace,fontScale,color,thickness){
         if (img == null || text == null){
                        logd("可选参数未填写");
                        toast("可选参数未填写");
                        return null;
                }
         if(org == null){org = new Point(0,0)}
         if(fontFace == null){fontFace = FONT_HERSHEY_PLAIN}
         if(fontScale == null){fontScale = 1.0}
         if(color == null){color = new Scalar(0,0,0)}
         if(thickness == null){thickness = 1}
          Imgproc.putText(img,text,org,fontFace,fontScale,color,thickness)
   }





